/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package fr.ove.openmath.jome.ctrlview.bidim;

/**
 *
 * @author Mr.Sam
 */
import java.awt.*;
import fr.ove.openmath.jome.ctrlview.bidim.DisplayableImpl;
import fr.ove.openmath.jome.ctrlview.bidim.Line;


/**
* The "tick" of the square root
*
* @author © 1999 DIRAT Laurent
* @version 2.0 22/07/1999
*/
public class SqrtTick extends DisplayableImpl {
    /**
    * The thickness of the tick
    */
    private int thickness;
    
    /**
    * The elements of the drawing of the tick
    */
    private Line line1;
    private Line line2;
    
    /**
    * Sets the thickness of the drawing.
    * @param thickness the thickness of the drawing.
    */
    public void setThickness(int thickness) {
        this.thickness = thickness;
    }
    
    /**
    * Returns the thickness of the drawing.
    */
    public int getThickness() {
        return thickness;
    }
    
    /**
    * The paint method of the object to display.
    * @param g the drawing area of the symbol.
    */
    public void paint(Graphics g) {
        int height = getHeight();
        int width = getWidth();
        
        g.fillRect(0, (int) Math.round(0.48f * (float) height), (int) Math.round(0.2f * (float) width), thickness);

        line1 = new Line(new Point((int) Math.round(0.1f * (float) width), (int) Math.round(0.48f * (float) height)),
                         new Point((int) Math.round(0.4f * (float) width), height),
                         thickness, Line.RIGHT);
        line1.draw(g);
        
        line2 = new Line(new Point((int) Math.round(0.4f * (float) width), height),
                         new Point(width - (int) Math.round(0.2f * (float) width), 0),
                         thickness, Line.CENTER);
        line2.draw(g);
        
        g.drawLine((int) Math.round(0.4f * (float) width), height, width - (int) Math.round(0.2f * (float) width), 0);
        
        g.fillRect(width - (int) Math.round(0.2f * (float) width), 0, (int) Math.round(0.2f * (float) width), thickness);
    }
}

